<?php

/**
 * admin的service
 * @author 陈德本
 */
class activeService extends commonService {

    /**
     *
     * @var activeDao
     */
    protected $pao;

    public function __construct() {
        parent::__construct();
        $this->pao = InitPHP::getDao("active");
    }

    /**
     * 根据id取出对应d活动
     * 
     * @param unknown $ids            
     * @return Ambigous
     */
    public function getAllByIds($ids) {
        $data = $this->pao->getAllByIds($ids);
        $user = InitPHP::getDao("user");
        foreach ($data as $k => $v) {
            $data[$k]['user'] = $user->getOne($v['user_id']);
        }
        return $data;
    }
    /**
     * 获取一定的条数
     * @param unknown $count
     * @return Ambigous <number, multitype:multitype: >
     */
    public function getSomeThing($count){
        $data=$this->pao->getList(array(),$count,0,"id","desc");
        $user = InitPHP::getDao("user");
        foreach ($data as $k => $v) {
            $data[$k]['user'] = $user->getOne($v['user_id']);
        }
        return $data;
    }

    /**
     * 获取用户的所有活动
     * 
     * @param unknown $uid            
     * @return Ambigous <number, multitype:multitype: >
     */
    public function getActiveByuid($uid) {
        $data = $this->pao->getAll(array(
            "user_id" => $uid
        ), "id", "desc");
        $user = InitPHP::getDao("user");
        foreach ($data as $k => $v) {
            $data[$k]['user'] = $user->getOne($v['user_id']);
        }
        return $data;
    }

    public function getRegInfo() {
        return $reginfoDao = $this->getRegInfoDao()->getAll();
    }

    public function getChargeInfo() {
        return $this->getChargeInfoDao()->getAll();
    }

    /**
     *
     * @return reg_infoDao
     */
    public function getRegInfoDao() {
        return InitPHP::getDao("reg_info");
    }

    /**
     *
     * @return charge_infoDao
     */
    public function getChargeInfoDao() {
        return InitPHP::getDao("charge_info");
    }
}